﻿' LibWowArmory
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports roncliProductions.LibWowArmory.Item.Info
Imports roncliProductions.LibWowArmory.Item.Tooltip
Imports System

Namespace roncliProductions.LibWowArmory.Character.Sheet

    ''' <summary>
    ''' A class that encapsulates an item
    ''' </summary>
    ''' <remarks></remarks>
    Public Class Item

        ''' <summary>
        ''' An unknown value tracked by Blizzard
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property DisplayInfoID As Integer

        ''' <summary>
        ''' The item's current durability
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Durability As Integer

        ''' <summary>
        ''' The ID of the gem in the 1st slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Gem0ID As Integer

        ''' <summary>
        ''' The ID of the gem in the 2nd slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Gem1ID As Integer

        ''' <summary>
        ''' The ID of the gem in the 3rd slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Gem2ID As Integer

        ''' <summary>
        ''' The icon of the gem in the 1st slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property GemIcon0 As String

        ''' <summary>
        ''' The icon of the gem in the 2nd slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property GemIcon1 As String

        ''' <summary>
        ''' The icon of the gem in the 3rd slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property GemIcon2 As String

        ''' <summary>
        ''' The icon of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Icon As String

        ''' <summary>
        ''' The item's identification number
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property ItemID As Integer

        ''' <summary>
        ''' The item level of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Level As Integer

        ''' <summary>
        ''' The maximum durability of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property MaxDurability As Integer

        ''' <summary>
        ''' The icon of the item that can make the permanent enchantment on this item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PermanentEnchantIcon As String

        ''' <summary>
        ''' The identification number of the item that can make the permanent enchantment on this item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PermanentEnchantItemID As Integer

        ''' <summary>
        ''' The ID of the permanent enchantment on the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PermanentEnchantID As Integer

        ''' <summary>
        ''' An unknown value tracked by Blizzard
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PickUp As String

        ''' <summary>
        ''' An unknown value tracked by Blizzard
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property PutDown As String

        ''' <summary>
        ''' An unknown value tracked by Blizzard
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RandomPropertiesID As Integer

        ''' <summary>
        ''' The rarity of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Rarity As Enums.RarityType

        ''' <summary>
        ''' The item's seed
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks>Not sure what this is.</remarks>
        Public Property Seed As Integer

        ''' <summary>
        ''' The equipped slot of the item
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Slot As Enums.ItemSlotType

        ''' <summary>
        ''' Gets the item information
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property Item As ItemInfo
            Get
                If ItemID = 0 Then
                    Return Nothing
                Else
                    Return New ItemInfo(ItemID)
                End If
            End Get
        End Property

        ''' <summary>
        ''' Gets the item's tooltip information
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property ItemTooltip As ItemTooltip
            Get
                If ItemID = 0 Then
                    Return Nothing
                Else
                    Return New ItemTooltip(ItemID)
                End If
            End Get
        End Property

        ''' <summary>
        ''' A constructor to create new item information
        ''' </summary>
        ''' <param name="intDisplayInfoID"></param>
        ''' <param name="intDurability"></param>
        ''' <param name="intGem0ID"></param>
        ''' <param name="intGem1ID"></param>
        ''' <param name="intGem2ID"></param>
        ''' <param name="strGemIcon0"></param>
        ''' <param name="strGemIcon1"></param>
        ''' <param name="strGemIcon2"></param>
        ''' <param name="strIcon"></param>
        ''' <param name="intID"></param>
        ''' <param name="intLevel"></param>
        ''' <param name="intMaxDurability"></param>
        ''' <param name="strPermanentEnchantIcon"></param>
        ''' <param name="intPermanentEnchantItemID"></param>
        ''' <param name="intPermanentEnchant"></param>
        ''' <param name="strPickUp"></param>
        ''' <param name="strPutDown"></param>
        ''' <param name="intRandomPropertiesID"></param>
        ''' <param name="rRarity"></param>
        ''' <param name="intSeed"></param>
        ''' <param name="isSlot"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal intDisplayInfoID As Integer, ByVal intDurability As Integer, ByVal intGem0ID As Integer, ByVal intGem1ID As Integer, ByVal intGem2ID As Integer, ByVal strGemIcon0 As String, ByVal strGemIcon1 As String, ByVal strGemIcon2 As String, ByVal strIcon As String, ByVal intID As Integer, ByVal intLevel As Integer, ByVal intMaxDurability As Integer, ByVal strPermanentEnchantIcon As String, ByVal intPermanentEnchantItemID As Integer, ByVal intPermanentEnchant As Integer, ByVal strPickUp As String, ByVal strPutDown As String, ByVal intRandomPropertiesID As Integer, ByVal rRarity As Enums.RarityType, ByVal intSeed As Integer, ByVal isSlot As Enums.ItemSlotType)
            DisplayInfoID = intDisplayInfoID
            Durability = intDurability
            Gem0ID = intGem0ID
            Gem1ID = intGem1ID
            Gem2ID = intGem2ID
            GemIcon0 = strGemIcon0
            GemIcon1 = strGemIcon1
            GemIcon2 = strGemIcon2
            Icon = strIcon
            ItemID = intID
            Level = intLevel
            MaxDurability = intMaxDurability
            PermanentEnchantIcon = strPermanentEnchantIcon
            PermanentEnchantItemID = intPermanentEnchantItemID
            PermanentEnchantID = intPermanentEnchant
            PickUp = strPickUp
            PutDown = strPutDown
            RandomPropertiesID = intRandomPropertiesID
            Rarity = rRarity
            Seed = intSeed
            Slot = isSlot
        End Sub

        ''' <summary>
        ''' Gets the item information from one of the gems in this item
        ''' </summary>
        ''' <param name="intGemSlot">The slot of the gem, either 0, 1, or 2.</param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function GetGem(ByVal intGemSlot As Integer) As ItemInfo
            Dim intGem As Integer
            Select Case intGemSlot
                Case 0
                    intGem = Gem0ID
                Case 1
                    intGem = Gem1ID
                Case 2
                    intGem = Gem2ID
                Case Else
                    Throw New ArgumentException("You can only get a gem in slots 0, 1, or 2.")
            End Select
            If intGem = 0 Then
                Return Nothing
            Else
                Return New ItemInfo(intGem)
            End If
        End Function

    End Class

End Namespace
